home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
701_800
/
DISK0709
/
DISK0709.ZIP
/
INSTACAL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-05
|
25KB
|
849 lines
program INSTACAL;
{ INSTACAL.PAS - calendar generator written in Turbo Pascal
*******************************************************************************
* *
* *
* INSTACAL - Version 2.2 *
* *
* Copyright 1988 *
* by *
* James Michael Shellem *
* Woodlyn, Pennsylvania *
* *
* *
******************************************************************************}
{$R+,U+,B-}
type
CALTYPE = array[1..66, 1..80] of CHAR;
STRING9 = string[9];
REGS_TYPE = record
case INTEGER of
1 : (AX, BX, CX, DX, BP, SI, DI, DS, ES, FLAGS : INTEGER);
2 : (AL, AH, BL, BH, CL, CH, DL, DH : BYTE);
end;
var
CAL : CALTYPE;
YEARSTR : string[4];
MONTHSTR : STRING9;
I, J, K,
WEEK,
MONTH,
YEAR : INTEGER;
OUTFILE : TEXT;
CHOICE,
RETURN,
RESPONSE,
OUTDEVICE,
RES : CHAR;
LOW, HIGH : BYTE;
{------------------------------------------------------------------------------}
procedure READFK(var CHOICE : CHAR;
LOW, HIGH : BYTE);
{Read function key.}
var
REGS : REGS_TYPE;
I,
TEMP : INTEGER;
A : ARRAY[1..2] OF BYTE;
begin
REGS.AH := $1;
I := 1;
repeat
MSDOS(REGS);
A[I] := REGS.AL;
I := I + 1
until (I > 2) or (A[1] <> 0);
TEMP := (A[2] mod 256) - 10;
if not (A[2] in [LOW..HIGH]) then
WRITE(#8' ');
WRITELN;
if (TEMP < 0) then
TEMP := TEMP + 10;
CHOICE := CHR(TEMP)
end;
{------------------------------------------------------------------------------}
procedure READCH(var CHOICE : CHAR);
{Read key pressed.}
var
REGS : REGS_TYPE;
begin
REGS.AH := $1;
MSDOS(REGS);
if (REGS.AL = 0) then
begin
MSDOS(REGS);
WRITE(#8' ')
end;
WRITELN;
CHOICE := CHR(REGS.AL)
end;
{------------------------------------------------------------------------------}
procedure DRAW_WINDOW(X1, Y1, X2, Y2 : INTEGER);
var
X, Y : INTEGER;
begin
GOTOXY(X1, Y1);
for X := X1 to X2 do
WRITE(CHR(178));
for Y := Y1+1 to Y2-1 do
begin
GOTOXY(X1, Y);
WRITE(CHR(178));
GOTOXY(X2, Y);
WRITE(CHR(178))
end;
GOTOXY(X1, Y2);
for X := X1 to X2 do
WRITE(CHR(178))
end; {DRAW_WINDOW}
{------------------------------------------------------------------------------}
procedure INITIALIZE;
var
I, J : INTEGER;
begin
for I := 5 to 62 do
for J := 1 to 76 do
CAL[I, J] := ' ';
CLRSCR
end;
{------------------------------------------------------------------------------}
procedure YEARCAL;
{Generate yearly calendar.}
const
N = 1;
var
TEMP : string[1];
START, I1, J1,
M, C, Y, L, K,
D, D1, D2, TEMP2, ERROR,
I, J, DAY, DAYS : INTEGER;
TS : string[1];
begin {YEARCAL}
I := 5;
K := YEAR div 1000;
STR(K:1, TEMP);
CAL[I, 38] := TEMP;
K := (YEAR mod 1000) div 100;
STR(K:1, TEMP);
CAL[I, 40] := TEMP;
K := (YEAR mod 100) div 10;
STR(K:1, TEMP);
CAL[I, 42] := TEMP;
K := YEAR mod 10;
STR(K:1, TEMP);
CAL[I, 44] := TEMP;
CAL[10, 13] := 'J'; CAL[10, 14] := 'A'; CAL[10, 15] := 'N';
CAL[10, 16] := 'U'; CAL[10, 17] := 'A'; CAL[10, 18] := 'R';
CAL[10, 19] := 'Y';
CAL[10, 37] := 'F'; CAL[10, 38] := 'E'; CAL[10, 39] := 'B';
CAL[10, 40] := 'R'; CAL[10, 41] := 'U'; CAL[10, 42] := 'A';
CAL[10, 43] := 'R'; CAL[10, 44] := 'Y';
CAL[10, 64] := 'M'; CAL[10, 65] := 'A'; CAL[10, 66] := 'R';
CAL[10, 67] := 'C'; CAL[10, 68] := 'H';
CAL[23, 14] := 'A'; CAL[23, 15] := 'P'; CAL[23, 16] := 'R';
CAL[23, 17] := 'I'; CAL[23, 18] := 'L';
CAL[23, 40] := 'M'; CAL[23, 41] := 'A'; CAL[23, 42] := 'Y';
CAL[23, 64] := 'J'; CAL[23, 65] := 'U';
CAL[23, 66] := 'N'; CAL[23, 67] := 'E';
CAL[36, 14] := 'J'; CAL[36, 15] := 'U';
CAL[36, 16] := 'L'; CAL[36, 17] := 'Y';
CAL[36, 38] := 'A'; CAL[36, 39] := 'U'; CAL[36, 40] := 'G';
CAL[36, 41] := 'U'; CAL[36, 42] := 'S'; CAL[36, 43] := 'T';
CAL[36, 62] := 'S'; CAL[36, 63] := 'E'; CAL[36, 64] := 'P';
CAL[36, 65] := 'T'; CAL[36, 66] := 'E'; CAL[36, 67] := 'M';
CAL[36, 68] := 'B'; CAL[36, 69] := 'E'; CAL[36, 70] := 'R';
CAL[49, 13] := 'O'; CAL[49, 14] := 'C'; CAL[49, 15] := 'T';
CAL[49, 16] := 'O'; CAL[49, 17] := 'B'; CAL[49, 18] := 'E';
CAL[49, 19] := 'R';
CAL[49, 37] := 'N'; CAL[49, 38] := 'O'; CAL[49, 39] := 'V';
CAL[49, 40] := 'E'; CAL[49, 41] := 'M'; CAL[49, 42] := 'B';
CAL[49, 43] := 'E'; CAL[49, 44] := 'R';
CAL[49, 62] := 'D'; CAL[49, 63] := 'E'; CAL[49, 64] := 'C';
CAL[49, 65] := 'E'; CAL[49, 66] := 'M'; CAL[49, 67] := 'B';
CAL[49, 68] := 'E'; CAL[49, 69] := 'R';
for MONTH := 1 to 12 do
begin
M := MONTH - 2;
if M <= 0 then
M := M + 12;
C := YEAR div 100;
L := 0;
if (YEAR mod 4) = 0 then
L := 1;
if ((YEAR mod 100) = 0) and ((YEAR mod 400) <> 0) then
L := 0;
Y := YEAR mod 100;
D1 := N + TRUNC(2.6 * M - 0.2) + Y + (Y div 4) + (C div 4);
D2 := 2 * C + (1 + L) * (M div 11);
if (WEEK = 1) then
D := 1 + (D1 - D2) mod 7
else
D := ((9 - WEEK) + (D1 - D2)) mod 7;
if (D < 1) then
D := D + 7;
case MONTH of
1, 3, 5, 7, 8, 10, 12 : DAYS := 31;
2 : if L = 1 then
DAYS := 29
else
DAYS := 28;
4, 6, 9, 11 : DAYS := 30
end; {case}
case MONTH of
1 : begin
I1 := 10; J1 := 6
end;
2 : begin
I1 := 10; J1 := 31
end;
3 : begin
I1 := 10; J1 := 56
end;
4 : begin
I1 := 23; J1 := 6
end;
5 : begin
I1 := 23; J1 := 31
end;
6 : begin
I1 := 23; J1 := 56
end;
7 : begin
I1 := 36; J1 := 6
end;
8 : begin
I1 := 36; J1 := 31
end;
9 : begin
I1 := 36; J1 := 56
end;
10 : begin
I1 := 49; J1 := 6
end;
11 : begin
I1 := 49; J1 := 31
end;
12 : begin
I1 := 49; J1 := 56
end
end; {case}
I1 := I1 + 2;
case WEEK of
1 : begin
CAL[I1, J1 + 1] := 's'; CAL[I1, J1 + 4] := 'm';
CAL[I1, J1 + 7] := 't';
CAL[I1, J1 + 10] := 'w'; CAL[I1, J1 + 13] := 't';
CAL[I1, J1 + 16] := 'f'; CAL[I1, J1 + 19] := 's';
end;
2 : begin
CAL[I1, J1 + 1] := 'm'; CAL[I1, J1 + 4] := 't';
CAL[I1, J1 + 7] := 'w';
CAL[I1, J1 + 10] := 't'; CAL[I1, J1 + 13] := 'f';
CAL[I1, J1 + 16] := 's'; CAL[I1, J1 + 19] := 's';
end;
3 : begin
CAL[I1, J1 + 1] := 't'; CAL[I1, J1 + 4] := 'w';
CAL[I1, J1 + 7] := 't';
CAL[I1, J1 + 10] := 'f'; CAL[I1, J1 + 13] := 's';
CAL[I1, J1 + 16] := 's'; CAL[I1, J1 + 19] := 'm';
end;
4 : begin
CAL[I1, J1 + 1] := 'w'; CAL[I1, J1 + 4] := 't';
CAL[I1, J1 + 7] := 'f';
CAL[I1, J1 + 10] := 's'; CAL[I1, J1 + 13] := 's';
CAL[I1, J1 + 16] := 'm'; CAL[I1, J1 + 19] := 't';
end;
5 : begin
CAL[I1, J1 + 1] := 't'; CAL[I1, J1 + 4] := 'f';
CAL[I1, J1 + 7] := 's';
CAL[I1, J1 + 10] := 's'; CAL[I1, J1 + 13] := 'm';
CAL[I1, J1 + 16] := 't'; CAL[I1, J1 + 19] := 'w';
end;
6 : begin
CAL[I1, J1 + 1] := 'f'; CAL[I1, J1 + 4] := 's';
CAL[I1, J1 + 7] := 's';
CAL[I1, J1 + 10] := 'm'; CAL[I1, J1 + 13] := 't';
CAL[I1, J1 + 16] := 'w'; CAL[I1, J1 + 19] := 't';
end;
7 : begin
CAL[I1, J1 + 1] := 's'; CAL[I1, J1 + 4] := 's';
CAL[I1, J1 + 7] := 'm';
CAL[I1, J1 + 10] := 't'; CAL[I1, J1 + 13] := 'w';
CAL[I1, J1 + 16] := 't'; CAL[I1, J1 + 19] := 'f';
end
end;
I1 := I1 + 1;
if (D = 1) then
START := J1
else
START := J1 - 3 + (3 * D);
I := I1;
J := START;
DAY := 1;
repeat
if ((DAY div 10) <> 0) then
begin
TEMP2 := DAY div 10;
STR(TEMP2:1, TS);
CAL[I, J] := TS
end; {if}
TEMP2 := DAY mod 10;
STR(TEMP2:1, TS);
CAL[I, J + 1] := TS;
DAY := DAY + 1;
J := J + 3;
if J > (J1 + 19) then
begin
I := I + 1;
J := J1
end {if}
until (DAY > DAYS)
end; {for}
for I := 1 to 4 do
WRITELN(OUTFILE);
for I := 5 to 62 do
begin
for J := 1 to 76 do
WRITE(OUTFILE, CAL[I, J]);
WRITELN(OUTFILE)
end; {for}
if (OUTDEVICE in ['6', '7']) then
WRITE(OUTFILE, #12);
INITIALIZE
end; {YEARCAL}
{------------------------------------------------------------------------------}
procedure MONTHCAL(MONTH : INTEGER);
{Generate monthly calendar.}
const
N = 1;
var
START,
M, C, Y, L,
D, D1, D2, TEMP, ERROR,
I, J, DAY, DAYS : INTEGER;
TS : string[1];
begin {MONTHCAL}
VAL(YEARSTR, YEAR, ERROR);
if (RES = 'Y') or (OUTDEVICE = '5') then
begin
for I := 6 to 60 do
begin
CAL[I, 6] := CHR(221);
CAL[I, 76] := CHR(222)
end;
for J := 7 to 75 do
begin
CAL[10, J] := CHR(196);
CAL[13, J] := CHR(196)
end; {for}
I := 21;
repeat
for J := 7 to 75 do
CAL[I, J] := CHR(196);
I := I + 8
until (I > 61);
J := 16;
repeat
for I := 11 to 60 do
CAL[I, J] := CHR(179);
J := J + 10
until (J > 66);
for J := 6 to 76 do
begin
CAL[5, J] := CHR(219);
CAL[61, J] := CHR(219)
end; {for}
I := 10;
J :=16;
repeat
CAL[I, J] := CHR(194);
J := J + 10
until (J > 66);
I := 13;
J := 16;
repeat
repeat
CAL[I, J] := CHR(197);
J := J + 10
until (J > 66);
J := 16;
I := I + 8
until (I > 53);
end {if}
else
begin
for I := 6 to 60 do
begin
CAL[I, 6] := '|';
CAL[I, 76] := '|'
end;
for J := 7 to 75 do
begin
CAL[10, J] := '_';
CAL[13, J] := '_'
end; {for}
I := 21;
repeat
for J := 7 to 75 do
CAL[I, J] := '_';
I := I + 8
until (I > 61);
J := 16;
repeat
for I := 11 to 60 do
CAL[I, J] := '|';
J := J + 10
until (J > 66);
for J := 6 to 76 do
begin
CAL[5, J] := '*';
CAL[61, J] := '*'
end {for}
end; {else}
case MONTH of
1 : MONTHSTR := 'JANUARY';
2 : MONTHSTR := 'FEBRUARY';
3 : MONTHSTR := 'MARCH';
4 : MONTHSTR := 'APRIL';
5 : MONTHSTR := 'MAY';
6 : MONTHSTR := 'JUNE';
7 : MONTHSTR := 'JULY';
8 : MONTHSTR := 'AUGUST';
9 : MONTHSTR := 'SEPTEMBER';
10 : MONTHSTR := 'OCTOBER';
11 : MONTHSTR := 'NOVEMBER';
12 : MONTHSTR := 'DECEMBER'
end; {case}
START := (80 - ((LENGTH(MONTHSTR) + LENGTH(YEARSTR)) * 2 + 4)) div 2 + 3;
I := 8;
J := 1;
repeat
CAL[I, START] := MONTHSTR[J];
J := J + 1;
START := START + 2
until (J > LENGTH(MONTHSTR));
START := START + 3;
J := 1;
repeat
CAL[I, START] := YEARSTR[J];
J := J + 1;
START := START + 2
until (J > LENGTH(YEARSTR));
if (WEEK = 1) then
J := 10
else
J := (9 - WEEK) * 10;
for I := 1 to 7 do
begin
case I of
1 : begin
CAL[12, J] := 'S'; CAL[12, J+1] := 'U'; CAL[12, J+2] := 'N'
end;
2 : begin
CAL[12, J] := 'M'; CAL[12, J+1] := 'O'; CAL[12, J+2] := 'N'
end;
3 : begin
CAL[12, J] := 'T'; CAL[12, J+1] := 'U'; CAL[12, J+2] := 'E'
end;
4 : begin
CAL[12, J] := 'W'; CAL[12, J+1] := 'E'; CAL[12, J+2] := 'D'
end;
5 : begin
CAL[12, J] := 'T'; CAL[12, J+1] := 'H'; CAL[12, J+2] := 'U'
end;
6 : begin
CAL[12, J] := 'F'; CAL[12, J+1] := 'R'; CAL[12, J+2] := 'I'
end;
7 : begin
CAL[12, J] := 'S'; CAL[12, J+1] := 'A'; CAL[12, J+2] := 'T'
end
end;
J := (J + 10) mod 70;
if (J < 10) then
J := 70
end;
M := MONTH - 2;
if M <= 0 then
M := M + 12;
C := YEAR div 100;
L := 0;
if (YEAR mod 4) = 0 then
L := 1;
if ((YEAR mod 100) = 0) and ((YEAR mod 400) <> 0) then
L := 0;
Y := YEAR mod 100;
D1 := N + TRUNC(2.6 * M - 0.2) + Y + (Y div 4) + (C div 4);
D2 := 2 * C + (1 + L) * (M div 11);
if (WEEK = 1) then
D := 1 + (D1 - D2) mod 7
else
D := ((9 - WEEK) + (D1 - D2)) mod 7;
if (D < 1) then
D := D + 7;
case MONTH of
1, 3, 5, 7, 8, 10, 12 : DAYS := 31;
2 : if L = 1 then
DAYS := 29
else
DAYS := 28;
4, 6, 9, 11 : DAYS := 30
end; {case}
START := (D * 10) + 3;
I := 15;
J := START;
DAY := 1;
repeat
if ((DAY div 10) <> 0) then
begin
TEMP := DAY div 10;
STR(TEMP:1, TS);
CAL[I, J] := TS
end; {if}
TEMP := DAY mod 10;
STR(TEMP:1, TS);
CAL[I, J + 1] := TS;
DAY := DAY + 1;
J := J + 10;
if J > 74 then
begin
I := I + 8;
J := 13
end {if}
until (DAY > DAYS);
for I := 1 to 4 do
WRITELN(OUTFILE);
for I := 5 to 61 do
begin
for J := 1 to 76 do
WRITE(OUTFILE, CAL[I, J]);
WRITELN(OUTFILE)
end; {for}
if (OUTDEVICE in ['6', '7']) then
WRITE(OUTFILE, #12);
INITIALIZE
end; {MONTHCAL}
{------------------------------------------------------------------------------}
procedure DEVICE;
{Select output device.}
var
I : INTEGER;
DISKDRIVE : CHAR;
OUTFILENAME : string[14];
begin {DEVICE}
CLRSCR;
DRAW_WINDOW(12, 6, 68, 19);
GOTOXY(35, 9);
WRITE('Output Options');
GOTOXY(35, 10);
for I := 1 to 14 do
WRITE(CHR(196));
GOTOXY(19, 12);
WRITELN('<F5> = Preview calendar(s) on the screen'); GOTOXY(19, 14);
WRITELN('<F6> = Print calendar(s) from the printer'); GOTOXY(19, 16);
WRITELN('<F7> = Transfer calendar(s) to a file');
repeat
GOTOXY(20, 22);
WRITE('Press function key indicating your choice');
READFK(OUTDEVICE, 63, 65);
OUTDEVICE := UPCASE(OUTDEVICE)
until (OUTDEVICE in ['5', '6', '7']);
WRITELN;
case OUTDEVICE of
'5' : begin
ASSIGN(OUTFILE, 'CON:');
CLRSCR
end;
'6' : begin
ASSIGN(OUTFILE, 'LST:');
WRITELN; WRITELN;
if (RES = '?') and (CHOICE <> '3') then
begin
CLRSCR;
for I := 1 to 10 do
WRITELN;
repeat
GOTOXY(17, 12);
WRITE('Is your printer IBM Graphics compatible (Y/N)? >');
CLREOL;
READCH(RES); RES := UPCASE(RES)
until (RES in ['N', 'Y'])
end;
CLRSCR
end;
'7' : begin {set up output file}
repeat
CLRSCR;
GOTOXY(20, 9);
OUTFILENAME := '';
WRITELN('Enter the NAME of the text file to which you');
WRITE(' ':19, 'want the calendar(s) transferred >');
READLN(OUTFILENAME);
repeat
GOTOXY(20, 12);
WRITELN('Which DISK DRIVE will contain the');
WRITE(' ':19, 'file disk (A/B/C)? >');
CLREOL;
READCH(DISKDRIVE); WRITELN;
DISKDRIVE := UPCASE(DISKDRIVE)
until (DISKDRIVE in ['A', 'B', 'C']);
OUTFILENAME := CONCAT(DISKDRIVE, ':', OUTFILENAME);
WRITELN;
GOTOXY(20, 15);
WRITE('File name: ', OUTFILENAME);
repeat
GOTOXY(20, 16);
WRITE('Is this correct (Y/N)? >'); CLREOL;
READCH(RESPONSE);
RESPONSE := UPCASE(RESPONSE)
until (RESPONSE in ['Y', 'N'])
until (RESPONSE = 'Y'); {data entered is correct}
if (RES = '?') and (CHOICE <> '3') then
repeat
GOTOXY(20, 18);
WRITE('Is your printer IBM Graphics compatible (Y/N)? >');
CLREOL;
READCH(RES);
RES := UPCASE(RES)
until (RES in ['N', 'Y']);
ASSIGN(OUTFILE, OUTFILENAME);
CLRSCR;
GOTOXY(26, 12);
WRITE('writing to file ', OUTFILENAME, ' ...')
end
end; {case}
REWRITE(OUTFILE);
end; {DEVICE}
{------------------------------------------------------------------------------}
procedure MENU;
{Select and define calendar.}
var
MONSTR : string[2];
ERROR,
I, J : INTEGER;
{---------------------------------------------------------}
procedure CAL_WEEK;
{Select calendar week.}
var
WEEKCH : CHAR;
I : INTEGER;
begin
CLRSCR;
DRAW_WINDOW(24, 2, 55, 21);
GOTOXY(29, 4); WRITE('Calendar Week Options');
GOTOXY(29, 5);
for I := 1 to 21 do
WRITE(CHR(196));
GOTOXY(28, 7); WRITE('1. Sunday to Saturday');
GOTOXY(28, 9); WRITE('2. Monday to Sunday');
GOTOXY(28, 11); WRITE('3. Tuesday to Monday');
GOTOXY(28, 13); WRITE('4. Wednesday to Tuesday');
GOTOXY(28, 15); WRITE('5. Thursday to Wednesday');
GOTOXY(28, 17); WRITE('6. Friday to Thursday');
GOTOXY(28, 19); WRITE('7. Saturday to Friday');
repeat
GOTOXY(22, 24);
WRITE('Enter desired calendar week (1-7) >');
CLREOL;
READLN(WEEKCH);
until (WEEKCH in ['1'..'7']);
VAL(WEEKCH, WEEK, ERROR);
end;
{---------------------------------------------------------}
begin {MENU}
DRAW_WINDOW(5, 3, 75, 19); GOTOXY(32, 6);
WRITE('M A I N M E N U');
GOTOXY(32, 7);
for I := 1 to 17 do
WRITE(CHR(196));
GOTOXY(11, 10);
WRITE('<F1> = Create a calendar for a single month');
GOTOXY(11, 12);
WRITE('<F2> = Create calendars for each month of an entire year');
GOTOXY(11, 14);
WRITE('<F3> = Create a single calendar showing an entire year');
GOTOXY(11, 16);
WRITE('<F4> = Quit');
repeat
GOTOXY(19, 22);
WRITE('Press function key indicating your choice');
READFK(CHOICE, 59, 62);
until (CHOICE in ['1'..'4']);
CLRSCR;
if CHOICE = '1' then
begin
DRAW_WINDOW(30, 4, 50, 19);
GOTOXY(34, 6); WRITE(' 1. January');
GOTOXY(34, 7); WRITE(' 2. February');
GOTOXY(34, 8); WRITE(' 3. March');
GOTOXY(34, 9); WRITE(' 4. April');
GOTOXY(34, 10); WRITE(' 5. May');
GOTOXY(34, 11); WRITE(' 6. June');
GOTOXY(34, 12); WRITE(' 7. July');
GOTOXY(34, 13); WRITE(' 8. August');
GOTOXY(34, 14); WRITE(' 9. September');
GOTOXY(34, 15); WRITE('10. October');
GOTOXY(34, 16); WRITE('11. November');
GOTOXY(34, 17); WRITE('12. December');
repeat
GOTOXY(30, 22);
WRITE('Enter MONTH (1-12) >');
CLREOL;
READLN(MONSTR);
VAL(MONSTR, MONTH, ERROR)
until (ERROR = 0) and (MONSTR <> '') and (MONTH in [1..12]);
WRITELN;
repeat
GOTOXY(28, 24);
WRITE('Enter YEAR (1600-2400) >');
CLREOL;
READLN(YEARSTR);
VAL(YEARSTR, YEAR, ERROR)
until (YEAR > 1599) and (YEAR < 2401) and (ERROR = 0) and
(YEARSTR <> '');
CAL_WEEK;
DEVICE;
MONTHCAL(MONTH)
end
else if (CHOICE = '2') then
begin
repeat
GOTOXY(28, 12);
WRITE('Enter YEAR (1600-2400) >');
CLREOL;
READLN(YEARSTR);
VAL(YEARSTR, YEAR, ERROR)
until (ERROR = 0) and (YEAR > 1599) and (YEAR < 2401) and
(YEARSTR <> '');
CAL_WEEK;
DEVICE;
for MONTH := 1 to 12 do
MONTHCAL(MONTH);
end {2}
else if (CHOICE = '3') then
begin
repeat
GOTOXY(28, 12);
WRITE('Enter YEAR (1600-2400) >');
CLREOL;
READLN(YEARSTR);
VAL(YEARSTR, YEAR, ERROR)
until (ERROR = 0) and (YEAR > 1599) and (YEAR < 2401) and
(YEARSTR <> '');
CAL_WEEK;
DEVICE;
YEARCAL;
end; {3}
CLOSE(OUTFILE)
end; {MENU}
{------------------------------------------------------------------------------}
begin {MAIN PROGRAM}
RES := '?';
CLRSCR;
DRAW_WINDOW(26, 1, 54, 17);
GOTOXY(36, 3); WRITE('INSTACAL');
GOTOXY(34, 4); WRITE('(version 2.2)');
GOTOXY(27, 5); for I := 1 to 27 do WRITE('_');
I := 7;
while (I <= 16) do
begin
J := 27;
while (J <= 53) do
begin
GOTOXY(J, I);
WRITE(CHR(196));
J := J + 1
end;
I := I + 2
end;
J := 30;
while (J <= 50) do
begin
I := 6;
while(I <= 16) do
begin
GOTOXY(J, I);
WRITE(CHR(179));
I := I + 1
end;
J := J + 4
end;
GOTOXY(28, 6); WRITE('s');
GOTOXY(32, 6); WRITE('m');
GOTOXY(36, 6); WRITE('t');
GOTOXY(40, 6); WRITE('w');
GOTOXY(44, 6); WRITE('t');
GOTOXY(48, 6); WRITE('f');
GOTOXY(52, 6); WRITE('s');
GOTOXY(26, 20); WRITE('INSTAnt CALendar generator by');
GOTOXY(34, 22); WRITE('Jim Shellem');
GOTOXY(34, 23); WRITE('Woodlyn, PA');
GOTOXY(33, 24); WRITE('Copyright 1988');
delay(4000);
INITIALIZE;
repeat
CLRSCR;
MENU
until (CHOICE = '4');
CLRSCR;
end.